-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix MediaError #3562
Fix MediaError #3562
Conversation
For future reference, you can now change the base of a PR without opening a new one: https://github.com/blog/2224-change-the-base-branch-of-a-pull-request |
Mind: blown! I've been wanting that feature for years. |
if (typeof code === 'number') { | ||
this.code = code; | ||
} else if (typeof code === 'string') { | ||
function MediaError(value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this use the es6 class syntax, and be a constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, it could, but I'd prefer not needing to go through another code review if it can be avoided.
LGTM other than my comment on es6 class syntax |
const createNativeMediaError = (code, message) => { | ||
const err = Object.create(window.MediaError); | ||
|
||
Object.defineProperty(err, 'code', {value: code}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this fails in IE8
Merged to stable, closing. |
We discovered that attempting to construct a video.js
MediaError
object would fail to properly copy a nativeMediaError
object due to thecode
property being non-enumerable. Additionally, there were no tests for this module.This is a re-opening of #3560 against
stable
.Specific Changes proposed
MediaError
objects from nativeMediaError
objects by manually assigning thecode
property.MediaError
object to be redundantly constructed, such that if it is called with a video.jsMediaError
object, it simply returns the same object. This removes the need for two code forks found elsewhere in the code.Requirements Checklist